﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UtilZ.Dotnet.Ex.Base;
using UtilZ.Dotnet.Ex.Communication.Net.Web;

namespace UtilZ.Tool.HostPluginBase
{
    /// <summary>
    /// 主机插件接口
    /// </summary>
    public interface IHostPlugin : IDisposableZ
    {
        /// <summary>
        /// 插件标识
        /// </summary>
        string ID { get; }

        /// <summary>
        /// 插件名称
        /// </summary>
        string Name { get; }

        /// <summary>
        /// 操作系统适配器,由主程序设置值
        /// </summary>
        IOSAdapter OSAdapter { get; set; }

        /// <summary>
        /// 初始化插件
        /// </summary>
        void Init();

        /// <summary>
        /// 启动
        /// </summary>
        void Start();

        /// <summary>
        /// 获取插件web资源信息,为null则表示无相关信息
        /// </summary>
        /// <returns>插件web资源信息,为null则表示无相关信息</returns>
        WebResourceInfo GetWebResourceInfo();

        /// <summary>
        /// 发送Websocket消息
        /// </summary>
        event EventHandler<WebsocketSendMessageArgs> SendWebsocketMessage;

        /// <summary>
        /// WebSocket接收消息处理
        /// </summary>
        /// <param name="webSocket">WebSocketClient</param>
        /// <param name="message">接收到的消息</param>
        void WebSocketReceiveMessage(WebSocketClient webSocket, ReceiveWebsocketMessage message);
    }


}
